from django.forms import ModelForm
from django import forms
from web import models

class StudentForm(ModelForm):


    class Meta:
        model=models.Student
        fields='__all__'

    def __init__(self,*args,**kwargs):
        super(StudentForm,self).__init__(*args,**kwargs)
        for name,field in self.fields.items():
            field.widget.attrs['class']='form-control'
            field.widget.attrs['placeholder']=field.label


class StudentForm2(ModelForm):
    class Meta:
        model=models.Student
        fields='__all__'
        widgets={
            'name':forms.TextInput(attrs={'class':'form-control'}),
            'age':forms.TextInput(attrs={'class':'form-control'}),
            'gender':forms.Select(attrs={'class':'form-control'}),
            'department':forms.Select(attrs={'class':'form-control'}),
            'teacher':forms.SelectMultiple(attrs={'class':'form-control'})
        }